<?php
// Editer une notice de la base

include('../config/config.php');
function editField($i, $fieldName, $fieldTitle, $fieldValue, $type){
	echo '	<tr';
	if (($i & 1)==1) echo ' class="odd"';
	echo ">\n";
	echo '		<td class="fieldTitle">'.$fieldTitle." : </td>\n";
	echo '		<td>';
	if ($type=='text') echo '<textarea name="'.$fieldName.'" cols="72">'.$fieldValue.'</textarea>';
	else echo '<input type="text" name="'.$fieldName.'" value="'.$fieldValue.'" size="60">';
	echo "</td>\n";
	echo "	</tr>\n";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" lang="en-gb" dir="ltr">
<head>
	<meta http-equiv="content-Type" content="text/html; charset=utf-8"/>
	<meta http-equiv="Content-Language" content="fr"/>
	<title>Vue détaillée</title>
 	<meta name="language" content="fr-FR" />
	<meta name="robots" content="nofollow" />
	<meta name="keywords" content="<?php echo $longTitle;?>" />
	<meta name="author" content="Archives Henri Poincaré"/>
	<meta name="publisher" content="Laboratoire d'Histoire des Sciences et de Philosophie" />
	<meta name="copyright" content="Université Nancy 2, CNRS" />
	<style type="text/css" media="screen">@import url(./styles/noticeBib.css);</style>
	<link rel="shortcut icon" type="image/x-icon" href="images/favicon.ico"/>
</head>
<body>
<div id="main" style="padding:0 1em;">
	<div id="searchForm" style="">
<?php
// Fichier de configuration fonction du serveur
include('../config/config.php');
$dsn='mysql:host='.$host.';port='.$port.';dbname='.$dbname;

include("../model/model.php");
$a = new model($dsn, $user, $pass);

$item = $a->selectItem($from, 'id', $_GET['id']);
?>

<div style="padding-bottom:0.5em; color:red;">Edition de la notice <?php echo $_GET['id']?></div>


<form method="post" action="index.php?<?php echo urldecode($_SERVER["QUERY_STRING"])?>&amp;saveid=on">
<table id="viewItem">
<?php
// Form display
$i='';
foreach($fieldTable as $key=>$value){
	$i++; editField($i, $key, $value[0], $item[0][$key], $value[1]);
}
?>
</table>
<div style="text-align:center; padding:1em;"><input type="submit" value="Sauvegarder"></div>
</form>

	</div>
</div>

</body>
</html>
